home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Add-Ons / After Dark / Refractor 1.0 / Source / Refractor.h < prev   
Text File  |  1995-11-05  |  2KB  |  73 lines

  1. //////////
  2. //
  3. //    Refractor 1.0
  4. //    ©1995 Steven J. Bushell
  5. //
  6. //////////
  7. #pragma once
  8.  
  9. #include <QDOffscreen.h>
  10. #include "GraphicsModule_Types.h"
  11.  
  12. #if powerc
  13.     const long    maxBoxSize = 512L;
  14. #else
  15.     #if __MC68881__
  16.         const long    maxBoxSize = 256L;
  17.     #else
  18.         const long    maxBoxSize = 128L;
  19.     #endif
  20. #endif
  21. const long    maxSlopSize = 16L;
  22.  
  23. typedef struct RStorage
  24. {
  25.     Rect            travelRect;        //    the moving pane
  26.     Rect            slopRect;        //    the moving pane plus its update region.
  27.     Rect            oldSlopRect;    //    the slopRect from the previous frame.
  28.     Fixed            travelAngle;    //    the current angle refraction is traveling.
  29.     Fixed            travelSin;        //    the current sin of angle of travel.
  30.     Fixed            travelCos;        //    the current cos of angle of travel.
  31.     short            hDir;            //    current sign of x-component of velocity
  32.     short            vDir;            //    current sign of y-component of velocity
  33.     short            timeToReselect;    //    is it time to select a new random style?
  34.     short            needToUpdate;    //    do we need to update the offset buffer?
  35.     unsigned long    lastTouch;        //    the time of the last size slider touch (for tracking)
  36.     short            timeToChange;    //    is it time to change direction
  37.     short            refractorStyle;    //    popup choice
  38.  
  39.     GWorldPtr        srcWorld;        //    Image of a portion of the untouched screen.
  40.     GWorldPtr        dstWorld;        //    The pixels about to be blitted to the screen.
  41.     Handle            offsetBuffer;    //    Contains the array of offsets for each pixel.
  42.     RgnHandle        drawRgn;        //    Where are we going to draw?
  43.     RgnHandle        oldDrawRgn;        //    Where did we draw?
  44.  
  45.     //    Off-screen drawing support.
  46.     PixMapHandle    worldPixels;    //    active pixels when drawing offscreen.
  47.     CGrafPtr        savedCPort;        //    CPort to restore when done drawing offscreen.
  48.     GDHandle        savedGDevice;    //    Device Handle to restore when done drawing offscreen.
  49.  
  50. } RStorage, *RStoragePtr, **RStorageHandle;
  51.  
  52. //    Core routines.
  53. OSErr DoInitialize(Handle *storage, RgnHandle blankRgn, GMParamBlockPtr params);
  54. void CleanUp(RStorage** storage);
  55. OSErr DoBlank(Handle storage, RgnHandle blankRgn, GMParamBlockPtr params);
  56. OSErr DoDrawFrame(Handle storage,RgnHandle blankRgn,GMParamBlockPtr params);
  57. OSErr DoClose(Handle storage,RgnHandle blankRgn,GMParamBlockPtr params);
  58. OSErr DoSetUp(RgnHandle blankRgn,short message,GMParamBlockPtr params);
  59.  
  60. //    Popup values.
  61. enum
  62. {
  63.     eRandom = 1,
  64.     eWavyGravy = 3,
  65.     eHurricane,
  66.     eFisheye,
  67.     eWildDiffuser,
  68.     eSpectacle,
  69.     eMagnifier,
  70.     eWormhole,
  71.     eRipple
  72. };
  73.